package models.repository.common;

import com.mysql.jdbc.NotImplemented;
import models.entities.*;
import models.exceptions.*;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
@Deprecated
public interface ProductRepository {
    ProductEntity getProduct(int id) throws GetEntityListException, IOException;

    PaginatedProductList<ProductEntity> getProductList(Integer categoryId, Integer rangeStart, Integer rangeEnd, Integer brandId, int brandPage) throws GetEntityListException, IOException;

    InputStream getProductImage(int productId, int number, int width, int height, String applicationPath, String type) throws GetEntityException, IOException;

    /**
     * @deprecated
     * User CategoryRepository instead
     */
    @Deprecated
    int createCategory(CategoryEntity category) throws CreateEntityException, IOException;

    @Deprecated
    CategoryEntity getCategories(int parentId) throws IOException;

    void addPictureToProduct(PictureEntity image, String applicationPath) throws CreateEntityException, IOException;

    void putInCategory(ProductEntity productEntity) throws CreateEntityException, IOException;

    boolean productHasPicture(int productId) throws Exception;

    int createBrand(BrandEntity brand) throws Exception, CreateEntityException;

    void addPictureToBrand(PictureEntity image, String applicationPath) throws Exception, CreateEntityException;

    boolean isBrandExists(String brandName) throws Exception;

    BrandEntity getBrand(String brandName) throws GetEntityException, IOException;

    InputStream getBrandImage(int id, int number, int width, int height, String applicationPath, String type) throws GetEntityException, IOException;

    void create(ProductEntity productEntity, List<File> images, File applicationPath) throws CreateEntityException, IOException;

    PaginatedProductList<ProductEntity> getRecentProducts(Integer pageNumber, Integer pageSize, Integer brandId) throws GetEntityException, IOException;

    int getImagesCount(int productId) throws GetEntityException, IOException;

    CategoryEntity getCategories() throws IOException;

    List<AutocompleteEntity> getBrandList(String q) throws IOException;

    void create(ProductEntity productEntity) throws CreateEntityException, IOException;

    boolean isProductExists(String title) throws IOException;

    void updatePrice(ProductEntity productEntity) throws IOException;

    /**
     * @deprecated Use CategoryRepository.getByTitle instead
     */
    @Deprecated
    CategoryEntity getCategoryByTitle(String title) throws IOException;

    void addExistingImageToProduct(Integer productId, int imageId) throws NotImplemented, UpdateEntityException, IOException;

    ProductEntity getByTitle(String title) throws IOException;

    List<PictureEntity> getAllProductImages(Integer productId) throws IOException;

    void deleteImage(PictureEntity picture) throws IOException;

    void addCategoryAlias(CategoryAliasEntity categoryAlias) throws CreateEntityException, IOException;

    void deleteCategoryAlias(int aliasId) throws DeleteEntityException, IOException;

    void addProductSource(ProductSourceEntity productSource) throws CreateEntityException, IOException;

    List<ProductSourceEntity> getProductSources(Integer id) throws GetEntityException, IOException;

    void updateProductSource(ProductSourceEntity productSource) throws UpdateEntityException, IOException;

    void update(ProductEntity productEntity) throws UpdateEntityException, IOException;

    ProductSourceEntity getProductSource(ProductSourceEntity productSource) throws GetEntityException, IOException;

}
